package jps.result;

import java.util.LinkedList;
import java.util.List;

import edu.pjwstk.jps.result.ISingleResult;
import edu.pjwstk.jps.result.IStructResult;

public class StructResult extends SingleResult implements IStructResult {
	private List<ISingleResult> list = new LinkedList<ISingleResult>();
	
	public StructResult(List<ISingleResult> list) {
		super();
		for(ISingleResult i: list){
            this.list.add(i);}		
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((list == null) ? 0 : list.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		StructResult other = (StructResult) obj;
		if (list == null) {
			if (other.list != null)
				return false;
		} else if (!list.equals(other.list))
			return false;
		return true;
	}

	public StructResult(ISingleResult... list) {
		super();
		for(ISingleResult i: list){
            this.list.add(i);}		
	}

	@Override
	public String toString() {
		return "\n  [StructResult] \n   [" + list + "]\n  [/StructResult] ";
	}

	@Override
	public List<ISingleResult> elements() {
		// TODO Auto-generated method stub
		return list;
	}

}
